import React from "react";

export default class OrderType_Item extends React.Component{
    constructor(props){
        super(props)
        this.state={
            ischose:false
        }
    }

    componentWillMount(){

    }

    unchose(){
        this.setState({
            ischose:false
        });
    }
    chose(){
        this.setState({
            ischose:true
        });
    }


    choseodtype(index,value){
        this.setState({
            ischose:true
        });
        this.props.choseodtype(index,value);
    }

    render(){
        let context = this.props.context.split(':')
        let name = context[0];
        let value = context[1]
        return (
            <span className={this.state.ischose?"order_all_chose":"order_all"}  onClick={this.choseodtype.bind(this,this.props.index,value)}>{name}</span>
        )
    }
}
